using System;

namespace Atomic.Structures
{
	[Serializable]
	public class ScaledBasis : Basis
	{
		public ScaledBasis(Basis baseBasis, double scaling)
			: base(baseBasis.A * scaling, baseBasis.B * scaling, baseBasis.C * scaling)
		{
			BaseBasis = baseBasis;
			Scaling = scaling;
		}

		public static ScaledBasis Create(Basis parentBasis, double scaling)
		{
			if (parentBasis is ScaledBasis)
			{
				return new ScaledBasis(parentBasis, ((ScaledBasis)parentBasis).Scaling * scaling);
			}

			return new ScaledBasis(parentBasis, scaling);
		}

		public Basis BaseBasis
		{
			get;
			private set;
		}

		public double Scaling
		{
			get;
			private set;
		}
	}
}
